package com.clkj.sunhelp.widget;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.support.v7.widget.AppCompatEditText;
import android.util.AttributeSet;
import android.widget.EditText;

import com.clkj.sunhelp.R;


/**
 * Created by Administrator on 2015/8/17.
 */
public class LineEditText extends AppCompatEditText {

    private Paint mPaint;
    private int status;
    public final static int STATUS_EDIT = 0X00011;
    public final static int STATUS_NORMAL = 0x00012;

    /**
     * @param context
     * @param attrs
     */
    public LineEditText(Context context, AttributeSet attrs) {
        super(context, attrs);
        // TODO Auto-generated constructor stub
        mPaint = new Paint();

        mPaint.setStyle(Paint.Style.STROKE);
        mPaint.setColor(context.getResources().getColor(R.color.gray));
        status = STATUS_NORMAL;
    }



    public int getStatus() {
        return status;
    }



    public void setStatus(int status) {
        this.status = status;
    }



    @Override
    public void onDraw(Canvas canvas)
    {
        super.onDraw(canvas);
       /* if (status==STATUS_EDIT) {*/
            canvas.drawLine(0,this.getHeight()-1,  this.getWidth()-1, this.getHeight()-1, mPaint);
            this.setSelection(this.getText().toString().length());
       /* }*/

//      画底线
    }
}
